import React, { Component } from 'react'
import Login from './pages/Login'
import Layout from './pages/Logout'
import AuthRoute from 'components/AuthRoute'
// 导入路由
import {Router, Route, Switch } from 'react-router-dom'
import NotFound from 'pages/NotFound'
import history from 'utils/history'

export default class App extends Component {
  render() {
    return (
      <Router history={history}>
        <div>
          <Switch>
            <Route path="/login" component={Login} />
            {/* 路由的二次封装，登录了有token，就是输入home不能跳转 */}
            <AuthRoute path="/home" component={Layout} />
            <Route component={NotFound} />
          </Switch>
        </div>
      </Router>
    )
  }
}
